//
//  FirstBalanceTableViewCell.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/23.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "FirstBalanceTableViewCell.h"

#define Margin 8

#define CellHeight 82

@implementation FirstBalanceTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self loadFirstTurnOverBalanceCell];
    }
    return self;
}

- (void)loadFirstTurnOverBalanceCell {
    UIImageView *headerImageView = [[UIImageView alloc] init];
#warning 设置头像图片
    headerImageView.image = [UIImage imageNamed:@"headgao"];
    headerImageView.layer.cornerRadius = 25;
    headerImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:headerImageView];
    
    [headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(Margin * 2);
        make.left.equalTo(self.contentView.mas_left).with.offset(Margin * 2);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.font = [UIFont systemFontOfSize:18];
    nameLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(18.0)];
    nameLabel.textAlignment = NSTextAlignmentLeft;
    self.nameLabel = nameLabel;
    [self.contentView addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(Margin * 2);
        make.left.equalTo(headerImageView.mas_right).with.offset(Margin * 2);
        make.width.mas_equalTo(WIDTH * 0.4);
        make.height.mas_equalTo(25);
    }];
    
    UILabel *welcomeLabel = [[UILabel alloc] init];
    welcomeLabel.text = @"欢迎登陆亿乐Go";
    welcomeLabel.font = [UIFont systemFontOfSize:14];
    welcomeLabel.textColor = [UIColor lightGrayColor];
    welcomeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:welcomeLabel];
    
    [welcomeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(nameLabel.mas_bottom);
        make.leading.equalTo(nameLabel.mas_leading);
        make.width.mas_equalTo(nameLabel.mas_width);
        make.height.mas_equalTo(nameLabel.mas_height);
    }];
    
    UILabel *rightLabel = [[UILabel alloc] init];
    rightLabel.text = @"合作商家";
    rightLabel.font = [UIFont systemFontOfSize:15];
    rightLabel.textAlignment = NSTextAlignmentCenter;
    rightLabel.textColor = DEFAULT_COLOR;
    [self.contentView addSubview:rightLabel];
    
    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right);
        make.top.equalTo(self.contentView.mas_top);
        make.width.mas_equalTo(CellHeight);
        make.height.mas_equalTo(CellHeight);
    }];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
